package com.atguigu.gmall.realtime.function;

import com.atguigu.gmall.realtime.util.AtguiguUtil;
import org.apache.flink.table.annotation.DataTypeHint;
import org.apache.flink.table.annotation.FunctionHint;
import org.apache.flink.table.functions.TableFunction;
import org.apache.flink.types.Row;

import java.util.Set;

/**
 * @Author lzc
 * @Date 2023/4/27 10:31
 */
@FunctionHint(output = @DataTypeHint("row<keyword string>"))
public class KwSplit extends TableFunction<Row> {
    // 约定方法:
    public void eval(String s){
        
        // 华为 华为手机
       Set<String> kws =  AtguiguUtil.ikSplit(s);
        for (String kw : kws) {
            collect(Row.of(kw));
        }
    }
}
